package com.example.springbootexamples.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

@RestController
public class UploadController {


    @RequestMapping(value = "upload",method = RequestMethod.POST)
    public Object upload(@RequestParam("file") List<MultipartFile> list){

        for(MultipartFile multipartFile:list){
            try {
                System.out.println(multipartFile.getName()+"\t"+new String(multipartFile.getBytes()));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        return "aa";
    }

}
